package cn.tedu.exercise;

import java.util.Scanner;

public class YearCompared {
    public static void main(String[] args) {
        System.out.println("请您输两个年份");
        int a=new Scanner(System.in).nextInt();
        int b=new Scanner(System.in).nextInt();
        System.out.println("您输入的是"+a+"和"+b);
        int result=method(a,b);
        System.out.println("两者相差的天数是"+result);
    }

    private static int method(int a, int b) {
        //闰年可以被4整除但不能被100整除或者能被400整除
        int dayA;
        int dayB;
        if (a%4==0 && a%100!=0 || a%400==0){
            dayA=366;
            System.out.println(a+"是闰年");
        }else{
            dayA=365;
            System.out.println(a+"是平年");
        }

        if (b%4==0 && b%100!=0 || b%400==0){
            dayB=366;
            System.out.println(b+"是闰年");
        }else{
            dayB=365;
            System.out.println(b+"是平年");
        }
        return dayA-dayB;
    }

}